package com.bdqn.controller;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bdqn.entity.PsSolvetaskDetail;
import com.bdqn.entity.PsSolvetaskMain;
import com.bdqn.service.IPsSolvetaskDetailService;
import com.bdqn.service.IPsSolvetaskMainService;



//缺陷类型管理
@RestController
public class XiaoQueController {

	@Autowired
	IPsSolvetaskMainService Ipsm;
	
	@Autowired
	IPsSolvetaskDetailService Ipsd;
	
	
	// 修改消缺任务
	@GetMapping("updateXiao")
	public boolean updateXiao(@RequestParam(name="id",required=false)Integer id,
			@RequestParam(name="solvetaskcode",required=false)String solvetaskcode,
			@RequestParam(name="solveTaskName",required=false)String solveTaskName,
			@RequestParam(name="taskStatusId",required=false)Long taskStatusId,
			@RequestParam(name="workDocTypeId",required=false)Long workDocTypeId,
			@RequestParam(name="taskdesc",required=false)String taskdesc,
			@RequestParam(name="common",required=false)String common,
			@RequestParam(name="taskfinishdesc",required=false)String taskfinishdesc) {
		PsSolvetaskMain psm=Ipsm.getById(id);
		psm.setSolvetaskcode(solvetaskcode);
		psm.setSolveTaskName(solveTaskName);
		psm.setTaskStatusId(taskStatusId);
		psm.setWorkDocTypeId(workDocTypeId);
		psm.setTaskdesc(taskdesc);
		psm.setCommon(common);
		psm.setTaskfinishdesc(taskfinishdesc);
		return Ipsm.updateById(psm);
	}

	//显示所有消缺任务
	@RequestMapping("selectAllXiao")
	public List<PsSolvetaskMain> selectAllXiao() {
		return Ipsm.selectAll();
	}
	@RequestMapping("delXiaoById")
	public boolean delXiaoById(@RequestParam(name="id",required=false)Integer id) {
		return Ipsm.removeById(id);
	}
	//显示消缺任务
	@RequestMapping("selectXiaoById")
	public PsSolvetaskMain selectXiaoById(@RequestParam(name="id",required=false)Integer id) {
		return Ipsm.selectXiaoById(id);
	}
	//显示消缺任务
	@RequestMapping("selectMissingById")
	public PsSolvetaskDetail selectMissingById(@RequestParam(name="TASKID",required=false)Integer tid) {
		return Ipsd.selectMissingById(tid);
	}
}
